<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>tpl</title>
</head>
<body>
    <div id="root"></div>
    <script id="tplContent" type="text/html">
    <ul id="idid" name='namename'>
    <% for(var i=0; i<data.length; i++){
        var word = "hello";
        word += ' world';
        var item = data[i];
        if(item.age < 30){%>
            <li data-world='<%=word%>' data-age="<%=item.age%>">我的名字是<%=item.name%>，我的年龄是<%=item.age%></li>
        <%}else{%>
            <li data-name="<%=item.name%>">my name is <%=item.name%>,my age is a sercet.</li>
        <%}%>
    <% } %>
    </ul>
    </script>
    <script src="../build/mini-tpl.js"></script>
    <script>
        var data = [{ name: 'tom', age: 12 }, { name: 'lily', age: 24 }, { name: 'lucy', age: 55 }];
        var content = document.getElementById('tplContent').innerHTML;
        var result = miniTpl(content, data);
        document.getElementById('root').innerHTML = result;
    </script>
</body>
</html>